﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using Rhino.Mocks;
using ValidationFramework.Web.MVC.Tests.Fakes;

namespace ValidationFramework.Web.MVC.Tests
{
	[TestFixture]
	public class RuleExtractorTests
	{

		[Test]
		public void Should_Leverage_Strategy_To_Do_Extraction()
		{
			// Arrange
			var fakeRuleInfos = new List<RuleInfo>();
			fakeRuleInfos.Add(new RuleInfo("TestMember", new Rule(new FakeValidator())));

			var strategy = MockRepository.GenerateStub<IRuleExtractionStrategy>();
			strategy.Stub(x => x.GetRules()).Return(fakeRuleInfos);
	
			// Act
			var extractor = new RuleExtractor(strategy);
			var results = extractor.Extract();

			// Assert
			strategy.AssertWasCalled(x => x.GetRules());
		}
	}
}
